package com.atguigu.srb.core.controller.api;


import com.atguigu.srb.base.response.R;
import com.atguigu.srb.core.pojo.entity.Dict;
import com.atguigu.srb.core.service.DictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 数据字典 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2023-05-26
 */
@RestController
//@CrossOrigin
@RequestMapping("/api/core/dict")
public class ApiDictController {
    @Resource
    DictService dictService;
    @ApiOperation("根据dictCode查询下一级数据字典集合")
    @GetMapping("dicts/{dictCode}")
    public R getDictsByDictCode(@PathVariable("dictCode")String dictCode){
        List<Dict> dicts = dictService.getDictsByDictCode(dictCode);
        return R.ok().data("items" , dicts);
    }

}

